<?php

namespace app\shopapi\model;

use think\Model;


class ShopFans extends Model
{
    protected $name = 'shop_fans';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;


    public function lists($params)
    {
        $lists = ShopFans::alias('f')
            ->join('user u','f.user_id = u.id')
            ->where(['f.shop_id'=>$params['shop_id']])
            ->field('u.nickname,u.avatar,f.*')
            ->order('f.createtime desc')
            ->paginate(10, false, ['query' => request()->get()]);

        return $lists;

    }
}